package cn.net.dpi.core.annotation;

import cn.net.dpi.core.validation.IsEnumValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 校验是否目标枚举类成员
 * {@link IsEnumValidator}
 * @author dzcr
 */
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = { IsEnumValidator.class })
public @interface IsEnum {

    Class<?> enumType();

    String message() default "目标值必须是 ${enumType.simpleName} 枚举类的成员值";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

}
